package krt.wid.gslzs.adpater;

import android.support.annotation.Nullable;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

import krt.wid.gslzs.R;
import krt.wid.gslzs.bean.NewsBean;
import krt.wid.gslzs.util.GlideUtil;

/**
 * @author Marcus
 * @package krt.wid.gslzs.adpater
 * @description
 * @time 2018/5/12
 */

public class NewsAdapter extends BaseQuickAdapter<NewsBean, BaseViewHolder> {
    public NewsAdapter(@Nullable List<NewsBean> data) {
        super(R.layout.item_news, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, NewsBean item) {
        helper.setText(R.id.title, item.getTheme())
                .setText(R.id.time, item.getInsertTime() != null ? item.getInsertTime().substring(0, 11) : item.getInsertTime());
        GlideUtil.loadWithPlaceHolder(mContext, item.getPhoto(), R.mipmap.showimg1, (ImageView) helper.getView(R.id.img));
    }
}
